#include <cctype>
#include <cstdio>
#include <stack>
#include <unordered_map>
#include <vector>

const int N = 1e5 + 100;

inline int read() {
  int x = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x;
}

int n, q, cnt;
int fa[N << 1], u[N], v[N], dep[N << 1];
std::unordered_map<int, int> map[N], edge[N];
std::vector<int> vec[N << 2];
std::stack<std::pair<int, bool> > stk;

inline int find(int x) { return fa[x] == x ? x : find(fa[x]); }

inline void merge(int x, int y) {
  if (x == y) return;
  if (dep[x] > dep[y]) std::swap(x, y);
  stk.push(std::make_pair(x, dep[x] == dep[y]));
  fa[x] = y;
  dep[y] += dep[x] == dep[y];
}

inline void insert(int x, int l, int r, int L, int R, int id) {
  if (L <= l && r <= R) {
    vec[x].push_back(id);
    return;
  }
  int mid = (l + r) >> 1;
  if (L <= mid) insert(x << 1, l, mid, L, R, id);
  if (mid < R) insert(x << 1 | 1, mid + 1, r, L, R, id);
}

inline void solve(int x, int l, int r) {
  bool flag = true;
  size_t t = stk.size();
  for (auto &it : vec[x]) {
    int from = find(u[it]), to = find(v[it]);
    if (from == to) {
      for (int i = l; i <= r; ++i) puts("NO");
      flag = false;
      break;
    }
    merge(find(u[it] + N), to), merge(find(v[it] + N), from);
  }
  int mid = (l + r) >> 1;
  if (flag) {
    if (l == r)
      puts("YES");
    else
      solve(x << 1, l, mid), solve(x << 1 | 1, mid + 1, r);
  }
  int i;
  bool j;
  while (stk.size() > t) {
    i = stk.top().first, j = stk.top().second;
    dep[fa[i]] -= j;
    fa[i] = i;
    stk.pop();
  }
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("CF813F Bipartite Checking.in", "r", stdin);
  freopen("CF813F Bipartite Checking.out", "w", stdout);
#endif
#endif

  n = read(), q = read();
  for (int x, y, i = 1; i <= q; i++) {
    x = read(), y = read();
    if (edge[x].find(y) == edge[x].end()) {
      edge[x][y] = ++cnt;
      u[cnt] = x, v[cnt] = y;
    }
    if (map[x].find(y) != map[x].end())
      insert(1, 1, q, map[x][y], i - 1, edge[x][y]), map[x].erase(y);
    else
      map[x][y] = i;
  }
  for (int i = 1; i <= n; i++)
    for (auto &x : map[i]) insert(1, 1, q, x.second, q, edge[i][x.first]);

  for (int i = 1; i <= n; ++i) fa[i] = i, fa[i + N] = i + N;
  solve(1, 1, q);
  return 0;
}
